<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
  <p>
  http://www.apache.org/licenses/LICENSE-2.0
  <p>
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<ng2-toasty [position]="'top-center'"></ng2-toasty>
<div data-ma-theme="green" class="login">
    <!-- 登录表单 -->
    <div class="login__block active" id="l-login">
        <div class="login__block__header">
            <i class="zmdi zmdi-account-circle"></i>
            欢迎使用Wikift
            <a class="btn" [routerLink]="['/user/register']">
                <i class="fa fa-plus" tooltip="点击我注册用户" placement="bottom"></i>
            </a>
        </div>
        <div class="login__block__body">
            <form #loginForm="ngForm" (ngSubmit)="login()">
                <div class="form-group form-group--float form-group--centered">
                    <input type="text" [(ngModel)]="user.username" name="username" #username="ngModel" class="form-control" required placeholder="请输入用户名"
                    />
                    <p class="text-danger" *ngIf="username.errors?.rangeLength">输入字符长度在5-9之间</p>
                </div>
                <div class="form-group form-group--float form-group--centered">
                    <input type="password" [(ngModel)]="user.password" name="password" #password="ngModel" [rangeLength]="[8, 20]" class="form-control"
                        required placeholder="请输入用户密码" />
                    <p class="text-danger" *ngIf="password.errors?.rangeLength">密码不能少于8位, 且不能大于20位</p>
                </div>
                <button [disabled]="!loginForm.form.valid" class="btn btn--icon login__block__btn" type="submit">
                    <i class="zmdi zmdi-arrow-forward"></i>
                </button>
            </form>
        </div>
    </div>
</div>